package com.example.cofeed.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.cofeed.R;

/**
 * Created by mqwang on 2017/9/18.
 */

public class DateSelectAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    public int selectPosition = -1;
    public DateSelectAdapter() {
        super(R.layout.item_date_select_list);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        if (helper.getLayoutPosition() == selectPosition){
            helper.setBackgroundRes(R.id.name_tv, R.drawable.bg_btn);
            helper.setTextColor(R.id.name_tv, mContext.getResources().getColor(R.color.colorWhite));
        }
        else{
            helper.setBackgroundRes(R.id.name_tv, R.drawable.bg_round);
            helper.setTextColor(R.id.name_tv, mContext.getResources().getColor(R.color.mainThemeColor));
        }

        helper.setText(R.id.name_tv, item);
    }

    public void setSelect(int select){
        this.selectPosition = select;
        notifyDataSetChanged();

    }
}
